package cn.gson.boot.model.service;

import cn.gson.boot.model.dao.KeFuDao;
import cn.gson.boot.model.dao.TouSuDao;
import cn.gson.boot.model.mapper.KeFuMapper;
import cn.gson.boot.model.mapper.TouSuMapper;
import cn.gson.boot.model.pojos.Kefu;
import cn.gson.boot.model.pojos.Tousu;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional(rollbackFor = Exception.class)
public class TouSuService {
    @Autowired
    TouSuDao touSuDao;
    @Autowired
    TouSuMapper touSuMapper;

    //新增投诉
    public void addTouSu(Tousu tousu) {
        tousu.setTsYs(1);
        touSuDao.save(tousu);
    }

    //查询所有投诉
    public List<Tousu> selectAllTouSu(String kName,String time) {
        return touSuMapper.selectAllTouSu(kName,time);
    }

    //移除投诉
    public void yichuKeFu(Integer tsId) {
        touSuDao.yichuTouSu(tsId);
    }
}